import 'dart:ui';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class BenchHeadWidget extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return BenchHeadState();
  }
}

class BenchHeadState extends State<BenchHeadWidget> {
  @override
  Widget build(BuildContext context) {
    return Container(
      height: 100,
      child: Stack(
        children: <Widget>[
          Image.asset("image/bg_vip.png", fit: BoxFit.cover, width: double.infinity,),
          Container(
            margin: EdgeInsets.only(left: 15, top: 20),
            child: Text("智云车帮二手车",
                style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
          ),
          Positioned(
              child: _getMemberWidget(context), bottom: 0, left: 15, right: 15)
        ],
      ),
    );
  }

  _getMemberWidget(BuildContext context) {
    return Container(
        height: 30,
        padding: EdgeInsets.only(left: 10, right: 10),
        decoration: BoxDecoration(
            borderRadius: BorderRadius.only(
                topLeft: Radius.circular(5), topRight: Radius.circular(5)),
            gradient: LinearGradient(colors: [
              Color(0xFFFEE5BF),
              Color(0xFFEFCD90),
            ], begin: Alignment.centerLeft, end: Alignment.centerRight)),
        child: Row(
          children: <Widget>[
            Image.asset("image/icon_vip_not.png"),
            Expanded(child: Text("有效期：2020-6-30")),
            InkWell(
              onTap: () {
                showAboutDialog(context: context);
              },
              child: Container(
                height: 20,
                padding: EdgeInsets.only(left: 10, right: 10),
                alignment: Alignment.center,
                decoration: BoxDecoration(
                    color: Color(0xFFB26909),
                    borderRadius: BorderRadius.all(Radius.circular(5))),
                child: Text(
                  "立即续费",
                  style: TextStyle(fontSize: 10, color: Colors.white),
                ),
              ),
            )
          ],
        ));
  }
}
